from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop030_编辑标签信息"
#打开网页，登录后台
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
# 点击商品管理商品标签商品标签分组
DBshopEnterMenu3(firefox,"商品管理","商品标签","商品标签分组")
# 点击“编辑”按钮，标签分类可改为“小米第二”，标签名称“小米机器人”，标签排序“2”
firefox.find_element_by_link_text("编辑").click()
firefox.find_element_by_id("tag_group_name").clear()
firefox.find_element_by_id("tag_group_name").send_keys("小米机器人")
firefox.find_element_by_id("tag_group_mark").clear()
firefox.find_element_by_id("tag_group_mark").send_keys("2")
# 点击“保存标签信息”按钮，编辑成功
firefox.find_element_by_xpath('//button[text()=" 保存标签组信息"]').click()
#断言
s=firefox.find_element_by_xpath('//*/table/tbody/tr[1]/td[2]').text
time.sleep(4)
print(s)

if  s == "小米机器人":
    writeLog("%s 测试通过" % (testCase))
else:
    writeLog("%s 测试失败" % (testCase))
    getPhoto(firefox)
firefox.quit()